<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>数组扁平化</title>
</head>
<body>
<!--
  数组扁平化: 取出嵌套数组(多维)中的所有元素放到一个新数组(一维)中
          如: [1, [3, [2, 4]]]  ==>  [1, 3, 2, 4]
-->
<script src="../lib/JustMicrobundle.umd.js"></script>
<script>
    // [1]  ---> [1, 3, 2, 4]
    // [3, [2, 4]] --> [3] --> [3, 2, 4]
    // [2, 4] --> [2, 4]
    console.log(JustMicrobundle.flatten1([1, [3, [2, 4]]]))
    console.log(JustMicrobundle.flatten2([1, [3, [2, 4]]]))
</script>
</body>
</html>
